/**
 * The MIT License (MIT)
 * 
 * Copyright (c) 2016 mo_yq5 (mo_yq5@163.com)
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 */
package com.vulgarsdk.captcha;

/**
 * 邮箱验证码配置对象
 * @author mo_yq5
 * @since 2016年1月17日
 */
public class CaptchaSettingEmail extends CaptchaSettingAbstract {

	/**
	 * 获取参数名为“st.email.indate”的配置项值作为邮箱验证码有效期（单位：分钟）
	 * “st.email.indate”的值需为整型值
	 */
	@Override
	public int getIndate() {
		return Integer.parseInt(getProperty("st.email.indate"));
	}

	/**
	 * 获取参数名为“st.email.lag”的配置项值作为邮箱验证码重发间隔限制时间（单位：秒）
	 * “st.email.lag”的值需为整型值
	 */
	@Override
	public int getLag() {
		 return Integer.parseInt(getProperty("st.email.lag"));
	}

	/**
	 * 获取参数名为“st.email.break”的配置项值作为邮箱验证码输入错误限制次数（单位：次），
	 * “st.email.break”的值需为整型值
	 */
	@Override
	public int getBreak() {
		 return Integer.parseInt(getProperty("st.email.break"));
	}

	/**
	 * 获取参数名为“st.email.type”的配置项值作为邮箱验证码类型，
	 * “st.email.type”的值需为整型值，并在0~2范围内，0数字，1字母，2数字和字母组合
	 */
	@Override
	public CaptchaType getType() {
		return CaptchaType.values()[Integer.parseInt(getProperty("st.email.type"))];
	}

	/**
	 * 获取参数名为“st.email.type”的配置项值来指定邮箱验证码长度，
	 * “st.email.type”的值需为整型值
	 */
	@Override
	public int getLength() {
		return Integer.parseInt(getProperty("st.email.length"));
	}

}
